package com.springboot2.jpa.controller;

import com.springboot2.jpa.bean.Article;
import com.springboot2.jpa.bean.Author;
import com.springboot2.jpa.bean.Book;
import com.springboot2.jpa.dao.ArticleRepository;
import com.springboot2.jpa.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class UserController {

    @Resource
    private UserService userService;
    @Resource
    private ArticleRepository repository;


    @GetMapping("/query")
    public Object query() {
        return userService.query();
    }

    @GetMapping("/save")
    public void save() {
        userService.save();
    }

    @GetMapping("/saveCategory")
    public List saveCategory() {
        return userService.saveCategory();
    }

    @GetMapping("/saveBook")
    public Book saveBook() {
        return userService.saveBook();
    }

    @GetMapping("/queryBook")
    public List queryBook() {
        return userService.queryBook();
    }

    @GetMapping("/saveArticle")
    public Article saveArticle() {
        return userService.saveArticle();
    }

    @GetMapping("/saveAuthor")
    public Author saveAuthor() {
        return userService.saveAuthor();
    }

    @GetMapping("/queryAuthor")
    public Object queryAuthor() {
        return userService.queryAuthor();
    }

    @GetMapping("/queryArticle")
    public Object queryArticle() {
        return userService.queryArticle();
    }

    @GetMapping("/queryArticlePage")
    public Object queryArticlePage() {
        return userService.queryArticlePage();
    }

    @GetMapping("/queryArticleById")
    public Object queryArticleById() {
        return userService.queryArticleById();
    }


}
